import './App.css';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import routes, { tabs } from './router';
import DefaultRoute from './views/common/defaultRoute/defaultRoute';
import Footer from '@/views/common/footer/footer'
import { connect } from 'react-redux';

const App = (props) => {
  return (
    <div>
      <Router>
        <Routes>
          {
            routes.map((item, index) => {
              return (
                <Route path={item.path}
                  key={index}
                  element={
                    <DefaultRoute 
                      useNav={item.useNav} 
                      field={item.field} 
                      title={item.title}
                      element={item.element} 
                      path={item.path} 
                      attr={item.attr} />}>
                </Route>
              )
            })
          }
        </Routes>
      </Router>
    </div>
  )
}

const mapStateToProps = (state) => {
  return state
}

export default connect(mapStateToProps)(App);